<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>用户反馈信息查看</title>
</head>
<link rel="stylesheet" href="../../../../res/layui/css/layui.css" media="all">
<script src="../../../../res/js/jquery-3.1.1.min.js" type="text/javascript"
		charset="utf-8"></script>
<script src="../../../../res/js/login_common.js"></script>
<script src="../../../../res/layui/layui.js" charset="utf-8"></script>
<script>
    $.ajaxSetup({
        async: false
    });
    $(function () {

        $("#seachTable").on("click", function () {
            //执行重载
            //带条件查询
            table2.reload({
                url: '../../../../BillTbController/selectAll',
                where: {
                    userName: $("#userName").val()
                },
                page: {curr: 1}
            });
        })
    });
</script>
<body>
</head>
<body style="padding: 5px;">
<div class="demoTable">
	<table class="layui-hide" id="test" lay-filter="test"></table>
	<input type="hidden" id="one">
	<script>
        $(function(){
            $("#add").click(function(){
                //iframe层
                layer.open({
                    type: 2,
                    title: '衣物回收增加页面',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['50%', '50%'],
                    content: 'yiwuhuishouadd.html', //iframe的url
                    end:function(){
                        table2.reload();
                    }
                });
            })
        })
        var table2=null;
        layui.use('table', function(){
            var table = layui.table;
            table2= table.render({
                elem: '#test'
                ,url:'../../../../dkm.dkmproject/orderTb/selectAllThree'
                ,page: true //开启分页
                , toolbar: '#headBtn'//开启头部工具栏，并为其绑定左侧模板
                ,title: '业务人员业务统计'
                ,cols: [[
                    {type: 'numbers', title: '排序'}//序列号 numbers
                    , {field:'orPhoneOne', title:'业务员电话', width:120}
                    ,{field:'orFwname', title:'业务员名字', width:120,}
                    , {field:'orIsva', title:'完成业务次数', width:180}
                ]]
            });


            //监听行工具事件
            table.on('tool(test)', function(obj){
                var data = obj.data;
                //console.log(obj)
                if(obj.event === 'del'){
                    layer.confirm('真的删除行么', function(index){
                        obj.del();
                        layer.close(index);
                        var url="../UserController/delete";
                        var dataone={"clId":data.clId};
                        $.post(url,dataone,function(obj){
                            if(obj.num==1){
                                layer.msg(obj.msg,{
                                    icon:1,
                                    time:1000 //1秒关闭(如果不配置默认三秒)
                                },function(){
                                    //刷新父页面
                                    parent.location.reload();
                                });
                            }else{
                                layer.msg(obj.msg);
                            }
                        },"json")
                    });
                } else if(obj.event === 'edit'){
                    var data1 = obj.data;//获取当前行
                    //iframe层
                    layer.open({
                        type: 2,
                        title: '菜单修改页面',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['60%', '56%'],
                        content: 'jsp/shangjiajsp/cdlbaddOrupdate.jsp?id='+data1.menuID, //iframe的url
                        end:function(){
                            table2.reload();
                        }
                    });
                }
            });


            //头工具栏事件
            table.on('toolbar(test)', function(obj){
                var checkStatus = table.checkStatus(obj.config.id);
                switch(obj.event){
                    case 'getCheckData':
                        layer.confirm('真的删除行么', function(index){
                            var data = checkStatus.data;
                            //layer.alert(JSON.stringify(data));
                            var ids="";//需要删除的id
                            $.each(data,function(index,idem){
                                ids+=idem.menuID+",";
                            })
                            if(ids==""){
                                layer.msg("请您选中需要删除的内容,不能为空!");
                            }
                            var url="MenuServlet?action=deleteAllone";
                            var datas={ids:ids};
                            $.post(url,datas,function(obj){
                                layer.msg(obj.msg);
                                table2.reload();//刷新表格
                            },"json");
                        });
                        break;

                    case 'seachTable'://搜索
                        $("#one").val($("#orFwname").val());
                        table2.reload({
                            url: '../../../../dkm.dkmproject/orderTb/selectAllThree',
                            where: {
                                orFwname: $("#orFwname").val()
                            },
                            //第一页开始
                            page: {
                                curr: 1
                            }
                        });
                        $("#orFwname").val($("#one").val());
                        break;

                };
            });
        });
	</script>
	<script type="text/html" id="barDemo">
		<a id="das" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>
	<script type="text/html" id="titleTpl">
		<img src='{{d.menuImage}}' alt='照片' onclick='showImg(this)' />
	</script>
	<script type="text/html" id="titleTpll">
		<img src='{{d.shoplicenceImg}}' alt='照片' onclick='showImg(this)' />
	</script>
	<script type="text/html" id="headBtn">
		用户账户:
		<div class="layui-inline">
			<input class="layui-input" name="orFwname" id="orFwname" placeholder="请输入业务人员关键字" autocomplete="off">

		</div>

		<input type="button" lay-event="seachTable" class="layui-btn layui-btn-normal layui-btn-sm" value="搜索"/>
	</script>

</body>
</body>
</html>